﻿using System;
using System.Runtime.Serialization;

namespace NCMIS.ObjectModel.MetaData
{
    /// <summary>
    /// Represents the permission mappings to allowable actions, mapping one allowable action to many permissions.
    /// Since an allowable action may require permissions on more than one object – for example, moving a document
    /// from one folder to another may require permissions on the document and each of the folders – the mapping
    /// table is defined in terms of permission "keys", where each key combines the name of the allowable action as
    /// the object for which the principal needs the required permission.
    /// </summary>
    /// <seealso cref="AllowableActions"/>
    [DataContract(Namespace = CmisNs.Cmis)]
    public class PermissionMapping
    {
        /// <summary>
        /// The allowable action, which is to have a permission associated to it.
        /// </summary>
        [DataMember(Name = "key")]
        public AllowableActionsKey Key
        {
            get;
            set;
        }

        /// <summary>
        /// The permission, which is to be mapped to an allowable action.
        /// </summary>
        [DataMember(Name = "permission")]
        public string[] permission
        {
            get;
            set;
        }
    }
}
